<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="initial-scale=1.0, maximum-scale=1, user-scalable=no">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <script src="/js/jquery.js"></script>
    <link rel="stylesheet" href="/css/element-ui@2.13.2.index.css">
    <script src="/js//vue.min.js"></script>
    <script src="/js/vue-resource.min.js"></script>
    <script src="/js/index.js"></script>
    <script src="/js/common.js"></script>
    <script src="/js/axios.min.js"></script>
    <!-- 字体图标css的引入 -->
    <link rel="stylesheet" href="/css/font_830376_qzecyukz0s.css">
    <link rel="stylesheet" href="/css/color-dark.css">
    <link rel="stylesheet" href="/css/icon.css">
    <link rel="stylesheet" href="/css/reset.css">
    <link rel="stylesheet" href="/css/base.css">
    <link rel="stylesheet" href="/css/bootstrap.min.css">
    <script src="/js/jquery.slim.min.js"></script>
    <script src="/js/popper.min.js"></script>
    <script src="/js/bootstrap.min.js"></script>
    <title></title>
</head>

<body>
<div id="manage">
    <!-- 头部 -->
    <div class="wrapper">
        <!-- 头部 -->
        <div class="header">
            <!-- 折叠按钮 -->
            <div class="header-left">
                人脸库管理
            </div>

            <!-- <div class="logo">后台管理系统</div> -->
            <div class="header-right">
                <div class="header-user-con">
                    <!-- 全屏显示 -->
                    <div class="btn-fullscreen" @click="handleFullScreen">
                        <el-tooltip effect="dark" :content="fullscreen?`取消全屏`:`全屏`" placement="bottom">
                            <i class="el-icon-rank"></i>
                        </el-tooltip>
                    </div>
                    <div class="user-avator">
                        <img src="/image/img.jpg" />
                    </div>
                    <!-- 用户名下拉菜单 -->
                    <el-dropdown class="user-name" trigger="click" @command="handleCommand">
                            <span class="el-dropdown-link">
                                {{username}}
                                <i class="el-icon-caret-bottom"></i>
                            </span>
                        <el-dropdown-menu slot="dropdown">
                            <a href="https://github.com/lin-xin/vue-manage-system" target="_blank">
                                <el-dropdown-item>项目仓库</el-dropdown-item>
                            </a>
                            <el-dropdown-item divided command="loginout">退出登录</el-dropdown-item>
                        </el-dropdown-menu>
                    </el-dropdown>
                </div>
            </div>
        </div>

        <!-- 侧边部分 -->
        <div data-v-68d67528="" class="sidebar">
            <ul data-v-68d67528="" role="menubar" class="sidebar-el-menu el-menu side-ul"
                style="background-color: rgb(50, 65, 87);">
                <li data-v-68d67528="" role="menuitem" tabindex="-1" class="el-menu-item"
                    style="padding-left: 20px; color: rgb(191, 203, 217); background-color: rgb(50, 65, 87);"><i
                        data-v-68d67528="" class="el-icon-lx-home"></i><span data-v-68d67528="">首页</span></li>
                <li data-v-68d67528="" role="menuitem" tabindex="-1" class="el-menu-item  is-active"
                    style="padding-left: 20px; color: rgb(32, 160, 255); background-color: rgb(50, 65, 87);"><i
                        data-v-68d67528="" class="el-icon-lx-calendar"></i><span data-v-68d67528="">人脸库管理</span>
                </li>
                <li data-v-68d67528="" role="menuitem" tabindex="-1" class="el-menu-item"
                    style="padding-left: 20px; color: rgb(191, 203, 217); background-color: rgb(50, 65, 87);"><i
                        data-v-68d67528="" class="el-icon-lx-global"></i><span data-v-68d67528="">特征查询</span></li>
            </ul>
        </div>

        <!-- 内容部分 -->
        <div class="content-box">
            <div class="content">
                <div>
                    <div class="crumbs">
                        <el-breadcrumb separator="/">
                            <el-breadcrumb-item>
                                <i class="el-icon-lx-calendar"></i> 人脸库管理
                            </el-breadcrumb-item>
                            <el-breadcrumb-item>{{title}}</el-breadcrumb-item>
                        </el-breadcrumb>
                    </div>
                    <div class="container">
                        <div class="form-box">
                            <el-page-header @back="back"></el-page-header>
                            <el-form ref="form" :model="form" label-width="200px">
                                <el-form-item  label="人脸库名称">
                                    <el-input v-model="form.set_name" readonly></el-input>
                                </el-form-item>
                                <el-form-item  label="是否需要加载">
                                    <el-input v-model="form.is_need_load" readonly></el-input>
                                </el-form-item>
                                <el-form-item  label="底库特征模型版本号">
                                    <el-input v-model="form.model_version" readonly></el-input>
                                </el-form-item>
                                <el-form-item  label="底库类型">
                                    <el-input v-model="form.set_type" :formatter="set_type_format" readonly></el-input>
                                </el-form-item>
                                <el-form-item  label="特征维度">
                                    <el-input v-model="form.feature_size" placeholder="0" readonly></el-input>
                                </el-form-item>
                                <el-form-item  label="租户ID(人脸库所有者ID)">
                                    <el-input v-model="form.app_id" readonly></el-input>
                                </el-form-item>
                                <el-form-item  label="人脸库最大能够存储ID数量">
                                    <el-input v-model="form.capacity" placeholder="0" readonly></el-input>
                                </el-form-item>
                                <nav aria-label="breadcrumb">
                                    <ol class="breadcrumb">
                                        <li class="breadcrumb-item active" aria-current="page">人脸库加载策略</li>
                                    </ol>
                                </nav>
                                <el-form-item  label="分片规则">
                                    <el-input v-model="form.strategy.slice_type" readonly></el-input>
                                </el-form-item>
                                <el-form-item  label="分片个数">
                                    <el-input v-model="form.strategy.slice_num" readonly></el-input>
                                </el-form-item>
                                <el-form-item  label="副本数">
                                    <el-input v-model="form.strategy.replication" readonly></el-input>
                                </el-form-item>
                                <el-form-item  label="检索类型">
                                    <el-input v-model="form.strategy.search_type" readonly></el-input>
                                </el-form-item>
                                <el-form-item  label="聚类中心">
                                    <el-input v-model="form.strategy.cluster_center" readonly></el-input>
                                </el-form-item>
                            </el-form>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

<script th:inline="javascript">
    var manage = new Vue({
        el: '#manage',
        data: {
            fullscreen: false,
            title: '人脸库详情',
            readonly: true,
            form: {
                set_name: null,
                is_need_load: true,
                model_version: null,
                set_type: '10',
                feature_size: null,
                app_id: null,
                capacity: null,
                strategy: {
                    slice_type: 'logic',
                    slice_num: null,
                    replication: null,
                    search_type: '0',
                    cluster_center: null,
                }
            }
        },
        watch: {

        },
        computed: {
            username() {
                let username = localStorage.getItem('ms_username');
                return username ? username : this.name;
            }
        },
        mounted() {

        },
        created() {
            // 获取详情数据
            axiosGetRequst('/api/library/query/' + [[${setName}]] + '/' + [[${modelVersion}]])
                .then(result => {
                    if (result.status == 200) {
                        const data = result.data;
                        this.form.set_name = data.set_name;
                        this.form.is_need_load = this.is_need_load_format(data.is_need_load);
                        this.form.model_version = data.model_version;
                        this.form.set_type = this.set_type_format(data.set_type);
                        this.form.feature_size = data.feature_size;
                        this.form.app_id = data.app_id;
                        this.form.capacity = data.capacity;
                        this.form.strategy.slice_type = this.slice_type_format(data.strategy.slice_type);
                        this.form.strategy.slice_num = data.strategy.slice_num;
                        this.form.strategy.replication = data.strategy.replication;
                        this.form.strategy.search_type = this.search_type_format(data.strategy.search_type);
                        this.form.strategy.cluster_center = data.strategy.cluster_center;
                    } else {
                        this.$message.error(result.message);
                    }
                })
        },
        methods: {

            // 数据动态显示
            // 获取set_type(底库类型) 的数据
            set_type_format(set_type) {
                switch (set_type) {
                    case 10:
                        return '静态底库';break;
                    case 20:
                        return '动态底库';break;
                    case 30:
                        return '抓拍库';break;
                    case 40:
                        return '聚类中心底库';break;
                    default:
                        return '静态底库';
                }
            },

            // 获取 is_need_load 的数据
            is_need_load_format(is_need_load) {
                if (is_need_load == true) {
                    return '是';
                }else {
                    return '否';
                }
            },

            // 获取 slice_type(分片规则) 的数据
            slice_type_format(slice_type) {
                if (slice_type == 0) {
                    return 'logic';
                }else {
                    return 'cluster';
                }
            },

            // 获取 seach_type(检索类型) 的数据
            search_type_format(search_type) {
                if (search_type == 0) {
                    return 'CPU';
                }else {
                    return 'GPU';
                }
            },


            back() {
                window.history.back(-1);
            },
            // 用户名下拉菜单选择事件
            handleCommand(command) {
                if (command == 'loginout') {
                    localStorage.removeItem('ms_username');
                    window.localStorage["token"] = '';
                    window.location.href = 'login';
                }
            },
            // 全屏事件
            handleFullScreen() {
                let element = document.documentElement;
                if (this.fullscreen) {
                    if (document.exitFullscreen) {
                        document.exitFullscreen();
                    } else if (document.webkitCancelFullScreen) {
                        document.webkitCancelFullScreen();
                    } else if (document.mozCancelFullScreen) {
                        document.mozCancelFullScreen();
                    } else if (document.msExitFullscreen) {
                        document.msExitFullscreen();
                    }
                } else {
                    if (element.requestFullscreen) {
                        element.requestFullscreen();
                    } else if (element.webkitRequestFullScreen) {
                        element.webkitRequestFullScreen();
                    } else if (element.mozRequestFullScreen) {
                        element.mozRequestFullScreen();
                    } else if (element.msRequestFullscreen) {
                        // IE11
                        element.msRequestFullscreen();
                    }
                }
                this.fullscreen = !this.fullscreen;
            },
        }
    })

</script>

</body>

</html>